import Cookies from 'js-cookie'

const state = {
    count: typeof Cookies.get('count') !== 'undefined' ? Cookies.get('count') : 0
}

const mutations = {
    INCREMENT: state => {
        state.count++
        Cookies.set('count', state.count, { sameSite: 'lax' })
    }
}

const actions = {
    increment({ commit }) {
        commit('INCREMENT')
    }
}

export default {
    namespaced: true,
    state,
    mutations,
    actions
}